<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path;
%>

<head>
    <meta charset="utf-8"/>
    <title>保险代理后台管理系统</title>
    <meta
            content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
            name="viewport"/>
    <!-- ================== BEGIN BASE CSS STYLE ================== -->
    <jsp:include page="../common/header.jsp"></jsp:include>
    <%@include file="../common/taglib.jsp" %>
    <!-- ================== END BASE CSS STYLE ================== -->
    <style>
        .dropdown-menu {
            position: absolute;
            top: 100%;
            left: 0;
            z-index: 1000;
            display: none;
            float: left;
            min-width: 160px;
            padding: 5px 0;
            margin: 2px 0 0;
            font-size: 14px;
            text-align: left;
            list-style: none;
            background-color: #fff;
            -webkit-background-clip: padding-box;
            background-clip: padding-box;
            border: 1px solid #ccc;
            border: 1px solid rgba(0,0,0,.15);
            border-radius: 4px;
        }
    </style>
</head>
<body>
<jsp:useBean id="currTime" class="java.util.Date"/>
<!-- begin #page-loader -->
<div id="page-loader" class="fade in">
    <span class="spinner"></span>
</div>
<!-- end #page-loader -->

<!-- begin #page-container -->
<div id="page-container"
     class="fade page-sidebar-fixed page-header-fixed">
    <jsp:include page="../common/top.jsp"/>
    <jsp:include page="../common/sitebar.jsp"/>
    <div class="sidebar-bg"></div>
    <div id="content" class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-inverse">
                    <section class="pad-top-10 pad-bottom-20">
                        <ul id="myTab" class="nav nav-tabs">
                            <input type="text" id="insurance-channel" value="66" hidden>
                            <li class="active"><a href="#" onclick="showInsurerOrder()" id="tab"
                                                  data-toggle="tab">保险公司</a></li>
                            <li><a href="#" onclick="showChannelOrder()" data-toggle="tab">渠道</a></li>
                            <li><a href="#tab3" id="perfect" onclick="showAddTab()" data-toggle="tab"
                                   class="hidden"></a></li>
                            <li class="link-down">
                                <span data-toggle="modal" data-target="#needpaid">
                                    <i class="fa fa-download"></i>&nbsp;
                                    下载列表
                                </span>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div id="tab1" class="tab-pane fade active in">
                                <section>
                                    <form class="form-inline p-t-10 p-b-10">
                                        <div class="form-group m-r-20">
                                            <label>保险公司：</label>
                                            <select class="form-control" id="insurerId1" style="width: 140px;">
                                                <option value="0">请选择</option>
                                                <c:forEach items="${insurerList }" var="insurer">
                                                    <option value="${insurer.tid }">${insurer.name }</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                        <div class="form-group m-r-20">
                                            <label>车牌号：</label>
                                            <input type="text" class="form-control"
                                                   id="plateNum1"
                                                   style="width: 200px;"
                                                   name="insurant">
                                        </div>
                                        <div class="form-group" style="position: relative;">
                                            <label>渠道：</label>
                                            <input type="text" id="channel" name="channel"
                                                   style="width: 200px;"
                                                   class="form-control" placeholder=""/>
                                            <input type="hidden" name="channelId" id="channelId">
                                            <ul id="ch" class="dropdown-menu"
                                                style="width: 200px;overflow: auto;margin-left: 46px;">
                                            </ul>
                                        </div>
                                        <input type="hidden" name="message" id="message">
                                        <div class="p-t-10">
                                            <div class="form-group m-r-20">
                                                <label>付款主体：</label>
                                                <select class="form-control"
                                                        style="width: 140px;"
                                                        id="themeKey">
                                                    <option value="0">请选择</option>
                                                    <c:forEach var="theme" items="${payThemeList }">
                                                        <option value="${theme.riskKey}">${theme.riskValue}</option>
                                                    </c:forEach>
                                                </select>
                                            </div>
                                            <div class="form-group m-r-10">
                                                <label>&emsp;状态：</label>
                                                <div class="input-group input-daterange">
                                                    <select class="form-control"
                                                    style="width: 200px;"
                                                    id="orderStatus">
                                                    <option value="0">请选择</option>
                                                    <c:forEach var="orderStatus"
                                                               items="${orderStatusList }">
                                                        <option value="${orderStatus.riskKey }">${orderStatus.riskValue }</option>
                                                    </c:forEach>
                                                    </select>
                                                </div>
                                            </div>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="searchInsurer()">
                                                查询
                                            </button>
                                        </div>
                                    </form>


                                    <%--<form class="form-horizontal">
                                        <div class="form-group">
                                            <label class="col-md-1 control-label" style="width: 110px;"></label>
                                            <div class="col-md-2">

                                            </div>
                                            <label class="col-md-1 control-label"></label>
                                            <div class="col-md-2">

                                            </div>
                                            <label class="col-md-1 control-label" style="width: 110px;"></label>
                                            <div class="col-md-2">

                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="col-md-1 control-label" style="width: 110px;"></label>
                                            <div class="col-md-2">

                                            </div>

                                            <label class="col-md-1 control-label">/label>
                                            <div class="col-md-2">

                                            </div>
                                            <div class="col-md-2">

                                            </div>
                                        </div>
                                    </form>--%>
                                    <table id="insurerList"
                                           class="table table-striped table-bordered"
                                           style="word-break: break-all; word-wrap: break-word">
                                        <thead>
                                        <tr>
                                            <th>编号</th>
                                            <th>保险公司</th>
                                            <th>付款主体</th>
                                            <th>渠道</th>
                                            <th>联系电话</th>
                                            <th>被保险人</th>
                                            <th>被保险人证件号</th>
                                            <th>车牌号</th>
                                            <th>车主姓名</th>
                                            <th>险种</th>
                                            <th>商业险保费(元)</th>
                                            <th>交强险保费(元)</th>
                                            <th>车船税(元)</th>
                                            <th>全保费(元)</th>
                                            <th>下单日期</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                    </table>
                                </section>
                            </div>
                            <div id="tab2" class="tab-pane fade">
                                <section>
                                    <form class="form-inline p-t-10 p-b-10">
                                        <div class="form-group m-r-20">
                                            <label>保险公司：</label>
                                            <select class="form-control"
                                                    style="width:181px;"
                                                    id="insurerId2">
                                                <option value="0">请选择</option>
                                                <c:forEach items="${insurerList }" var="insurer">
                                                    <option value="${insurer.tid }">${insurer.name }</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                        <div class="form-group m-r-20">
                                            <label>车牌号：</label>
                                            <input type="text" class="form-control"
                                                   style="width:181px;"
                                                   id="plateNum2"
                                                   name="insurant">
                                        </div>
                                        <div class="form-group m-r-20" style="position: relative">
                                            <label>渠道：</label>
                                            <input type="text" id="channels" name="channel"
                                                   style="width: 200px;"
                                                   class="form-control" placeholder=""/>
                                            <ul id="chs" class="dropdown-menu"
                                                style="overflow: auto;margin-left: 45px;width: 200px;">
                                            </ul>
                                        </div>
                                        <div class="p-t-10">
                                            <div class="form-group m-r-10">
                                                <label>出单日期：</label>
                                                <div class="input-group">
                                                    <input type="text" class="form-control datepicker-default"
                                                           id="insurantStartDate"
                                                           name="insurantStartDate">
                                                    <div class="input-group-addon">至</div>
                                                    <input type="text" class="form-control datepicker-default"
                                                           id="insurantEndDate"
                                                           name="insurantEndDate">
                                                </div>
                                            </div>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="searchChannel()">
                                                查询
                                            </button>
                                        </div>
                                    </form>
                                    <%-- <form class="form-horizontal">
                                         <div class="form-group">
                                             <label class="col-md-1 control-label" style="width: 110px;"></label>
                                             <div class="col-md-2">

                                             </div>
                                             <label class="col-md-1 control-label"></label>
                                             <div class="col-md-2">

                                             </div>
                                             <label class="col-md-1 control-label" style="width: 110px;"></label>
                                             <div class="col-md-2">

                                             </div>
                                         </div>
                                         <div class="form-group">
                                             <label class="col-md-1 control-label" style="width: 110px;"></label>
                                             <div class="col-md-2">

                                             </div>
                                             <div class="col-md-2">

                                             </div>
                                         </div>
                                     </form>--%>
                                    <table id="channelList"
                                           class="table table-striped table-bordered"
                                           style="word-break: break-all; word-wrap: break-word">
                                        <thead>
                                        <tr>
                                            <th>保单号</th>
                                            <th>保险公司</th>
                                            <th>付款主体</th>
                                            <th>渠道</th>
                                            <th>联系电话</th>
                                            <th>被保险人</th>
                                            <th>被保险人证件号</th>
                                            <th>车牌号</th>
                                            <th>车主姓名</th>
                                            <th>险种</th>
                                            <th>商业险保费(元)</th>
                                            <th>交强险保费(元)</th>
                                            <th>车船税(元)</th>
                                            <th>全保费(元)</th>
                                            <th>下单日期</th>
                                            <th>渠道返点</th>
                                            <th>返佣费(元)</th>
                                            <th>付款日期</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                    </table>
                                </section>
                            </div>
                            <div id="tab3" class="tab-pane fade ">
                                <div id="iframeParent">
                                    <iframe width="100%" height="100%" frameborder="0" id="iframe"
                                            scrolling="no"></iframe>
                                </div>
                                <!-- 提示框 -->
                                <div class="modal fade" id="modal-dialog2">
                                    <div class="modal-dialog modal-sm">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal"
                                                        aria-hidden="true">×
                                                </button>
                                                <h4 class="modal-title">取消内容</h4>
                                            </div>
                                            <div class="modal-body">
                                                当前填写内容未提交,确认取消?
                                            </div>
                                            <div class="modal-footer">
                                                <a href="javascript:;" onclick="showTab()"
                                                   class="btn btn-primary" data-dismiss="modal">确定</a>
                                                <a href="javascript:;" class="btn btn-default"
                                                   data-dismiss="modal">取消</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
                <!-- end panel -->
            </div>
            <!-- end col-12 -->
        </div>
        <!-- end row -->
    </div>
    <!-- end #content -->
</div>
<!-- end page container -->
<%--提示框--%>
<div class="modal fade" id="needpaid" style="display: none;">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">温馨提示</h4>
            </div>
            <div class="modal-body">
                确认下载当前列表信息
            </div>
            <div class="modal-footer">
                <button type="button" onclick="needpaid1()" class="btn btn-primary">确定</button>
                <a href="javascript:;" class="btn btn-default" data-dismiss="modal">取消</a>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="dwchannel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" style="width: 380px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h5 class="modal-title">结算</h5>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" data-parsley-validate="true" name="demo-form" id="payChannelRebateAmt">
                    <input id="tid" hidden name="tid">
                    <section class="form-horizontal">
                        <div class="form-group">
                            <label class="col-md-4 control-label" for="payDate">付返佣费日期 :</label>
                            <div class="col-sm-6">
                                <input type="text" value="<C:formatDate value="${currTime}" pattern="yyyy-MM-dd"/>"
                                       class="form-control datepicker-default" id="payDate" name="payDate"
                                       data-parsley-required="true" data-parsley-required-message="付返佣费日期必填"
                                       data-parsley-pattern="^[1-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1])$"
                                       data-parsley-pattern-message="请输入yyyy-MM-dd格式的日期"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-4" for="channelRebateAmt">付返佣费金额:</label>
                            <div class="col-sm-6">
                                <div class="input-group">
                                    <input class="form-control" type="text" id="channelRebateAmt"
                                           name="channelRebateFee" data-parsley-required="true"
                                           data-parsley-required-message="返佣费金额必填" data-parsley-money="true"
                                           data-parsley-money-message="数字格式不正确" placeholder="" onchange="updateCheckout()"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-4" for="remark">备注:</label>
                            <div class="col-sm-6">
                                <textarea class="form-control" id="remark" name="remark" rows="4"
                                          data-parsley-maxlength="100" data-parsley-maxlength-message="备注最大长度是100"
                                          placeholder=""></textarea>
                            </div>
                        </div>
                        <input type="hidden" id="channelMustRebateAmt">
                    </section>
                </form>
            </div>
            <div class="modal-footer">
                <a href="javascript:;" class="btn btn-white" data-dismiss="modal">取消</a>
                <a href="javascript:;" class="btn btn-success" onclick="payChannel()">确定</a>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="needpaid" style="display: none;">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">温馨提示</h4>
            </div>
            <div class="modal-body" id="showInfo">
            </div>
            <div class="modal-footer">
                <button type="button" onclick="needpaid1()" class="btn btn-primary">确定</button>
                <a href="javascript:;" class="btn btn-default" data-dismiss="modal">取消</a>
            </div>
        </div>
    </div>
</div>
<jsp:include page="../common/footer.jsp"/>
<script src="${ctx}/static/js/order/pay_order_list.js"></script>
</body>
<script>
    function showTab() {
        $("#perfect").addClass("hidden");
        $('#modal-dialog2').modal('hide')
        $("#tab").trigger("click");
    }
    function updateCheckout() {
        var channelMustRebateAmt = $("#channelMustRebateAmt").val();
        var channelRebateAmt = $("#channelRebateAmt").val();
        if(channelMustRebateAmt && channelMustRebateAmt == channelRebateAmt){
            $("#remark").removeAttrs("data-parsley-required");
            $("#remark").removeAttrs("data-parsley-required-message");
        }else{
            $("#remark").attr("data-parsley-required","true");
            $("#remark").attr("data-parsley-required-message","返佣费变更，备注必填");
        }
    }

</script>
</html>
